/**
 * 作者: 会写BUG
 * 创作日期: 2025/4/3 15:48
 * 描述: cwbQtPractice.AboutPanel
 *
 **/
#include "about_panel.h"

#include <QPainter>

AboutPanel::AboutPanel(QWidget* _parent)
    : QWidget(_parent)
{
    about_text_ = QString(R"(    cb2048游戏项目是一个Qt开发基础练习项目，其中包括：布局、自定义控件、控件绘制、文本读取和动画框架等。)");
}

AboutPanel::~AboutPanel()
{
}

void AboutPanel::paintEvent(QPaintEvent* event)
{
    QPainter painter(this);
    painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing);

    painter.setPen(Qt::transparent);
    painter.setBrush(QColor(229, 192, 148));

    QRect about_text_rect = QRect(0, 0, width(), height());
    painter.drawRect(about_text_rect);

    about_text_rect = about_text_rect.adjusted(10, 10, -10, -5);

    painter.setPen(Qt::white);
    painter.setFont(QFont("Arial", 14, QFont::DemiBold));
    painter.drawText(about_text_rect, Qt::TextWordWrap, about_text_);
}